package com.hue.gulimail.gulimailorder.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.hue.common.to.SeckillOrderTo;
import com.hue.common.utils.PageUtils;
import com.hue.gulimail.gulimailorder.entity.OrderEntity;
import com.hue.gulimail.gulimailorder.pay.PayVo;
import com.hue.gulimail.gulimailorder.vo.OrderConfirmVo;
import com.hue.gulimail.gulimailorder.vo.OrderResVo;
import com.hue.gulimail.gulimailorder.vo.OrderSubmitVo;

import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;

/**
 * 订单
 *
 * @author yaofengqiao
 * @email 451737523@qq.com
 * @date 2021-08-12 16:04:24
 */
public interface OrderService extends IService<OrderEntity> {

    PageUtils queryPage(Map<String, Object> params);

    /**
     * 获取订单确认信息
     *
     * @return
     */
    OrderConfirmVo getOrderConfirmVo() throws ExecutionException, InterruptedException;

    /**
     * 提交订单
     *
     * @param orderSubmitVo
     * @return
     */
    OrderResVo submitOrder(OrderSubmitVo orderSubmitVo) throws ExecutionException, InterruptedException, Exception;

    /**
     * 根据订单号查询订单信息
     *
     * @param orderSn
     * @return
     */
    OrderEntity getBySn(String orderSn);

    /**
     * 修改订单状态为已取消(如果还没有支付)
     *
     * @param order
     */
    void updateStatusToCancel(OrderEntity order);

    /**
     * 根据订单号获取一个PayVo
     *
     * @param orderSn
     * @return
     */
    PayVo getPayVoByOrderSn(String orderSn);

    /**
     * 获取一个会员的所有订单信息
     *
     * @return
     */
    List<OrderEntity> getMemberOrders();

    /**
     * 修改订单状态为已支付
     *
     * @param orderSn
     */
    void updateStatusToPay(String orderSn);

    /**
     * 创建秒杀订单
     *
     * @param seckillOrder
     */
    void createSeckillOrder(SeckillOrderTo seckillOrder);
}

